LocalStore	 = function(nspc){
	var cache = {};
	var namespace = nspc?nspc:'';
	return {
		set : function(prop,value){
			cache[prop] = value;
			window.localStorage.setItem(namespace+':'+prop,JSON.stringify(value));
		},
		get : function(prop){
			if(cache[prop] == undefined){
				cache[prop] = JSON.parse(window.localStorage.getItem(namespace+':'+prop));
			}
			return cache[prop];
		},
		remove : function(prop){
			if(cache[prop])
				delete cache[prop];
			window.localStorage.removeItem(namespace+':'+prop);
		},
		clear : function(){
			for(key in cache){
				this.remove(key);
			}
		},
		parse : function(props){
			if(props){
				for(key in props){
					this.set(key,props[key]);
				}
			}
		},
		/**
		* Method for testing perfomance, concerning time, when caching properties or not.
		* 
		* Example:
		* var store = new LocalStore();
		* var object = 	{
		*					property1:'value1',
		*					property2:'value2',
		*					property3:{
		*						property4:'value4',
		*						property5:'value5'
		*					}
		*				};
		* //without caching
		* store.test(100000,"testObject",object);
		* //with caching
		* store.test(100000,"testObject",object,true);
		*
		*
		* 
		* @loops: number of loops
		* @cachedEnabled: if caching of properties should be enabled
		*/
		test : function(loops,prop,value,cacheEnabled){
			var store;
			loops = loops||1000;
			prop = prop||'property';
			value = value||'value'

			if(cacheEnabled){
				store = this;
			}
			else {
				store = {
					set: function(prop,value){
						window.localStorage.setItem(':'+prop,JSON.stringify(value));
					},
					get: function(prop){
						JSON.parse(window.localStorage.getItem(':'+prop));
					}
				};
			}
			store.set(prop,value);

			var startTime = new Date().getTime();
			for(var i=0;i<loops;i++){
				store.get(prop);
			}
			var endTime = new Date().getTime();

			console.log("Time taken with cache " +(cacheEnabled?"enabled":"disabled")+": " + (endTime - startTime)+" milliseconds");
		}
	}
}